<!DOCTYPE html>
<html lang="zh_CN">
<head>
<title>骡窝窝</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/js/bootstrap/css/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="/css/core.css" type="text/css" />
<script type="text/javascript" src="/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/js/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/js/plugins/message/jquery.bootstrap.min.js"></script>
<script type="text/javascript" src="/js/plugins/jquery-form/jquery.form.js"></script>
<style type="text/css">
	body{
		background-color:  #FFFFFF;
	}
	.cm-container{
		margin-top: 160px;
	}
	.login {
		width: 360px;
		height: 300px;
		margin: 0px auto;
	}
</style>
<script type="text/javascript">
	$(function(){
	    $("#loginForm").ajaxForm(function (data) {
			// 响应回来的json是一个json形式的字符, 所以需要转成正式的json对象, 下面的data.success才能取到值
            console.log(data);
            // 方式1:将json字符串转成json对象
			// data = $.parseJSON(data);
            // 方式2, 发送ajax请求的最后的一个参数写上"json", 后端响应类型设置为json格式的类型就可以
            if(data.success){
                window.location.href="/user/list.do";
            }else{
                $.messager.alert("温馨提示:", data.msg)
            }
        });
		$("#btn_submit").click(function () {
		    $("#loginForm").submit();
        });
	});	
</script>

</head>
<body>
	<div class="container cm-container">
		<h3 class="text-center"><label style="color: #337ab7;">骡窝窝后台管理</label></h3>
		<hr />
		<div class="login">
			<form id="loginForm" action="/login.html" method="post">
				<div class="form-group form-group-lg">
					<div class="input-group">
						<div class="input-group-addon">账号</div>
						<input class="form-control" name="username" value="admin"/>
					</div>
				</div>
				<div class="form-group form-group-lg">
					<div class="input-group">
						<div class="input-group-addon">密码</div>
						<input class="form-control" name="password" type="password" value="1"/>
					</div>
				</div>
				<div class="form-group">
					<button type="button" class="btn btn-lg btn-primary btn-block" id="btn_submit">登录</button>
				</div>
			</form>
		</div>
	</div>
</body>
</html>